package com.zhituanbox.extensions.core;

import org.springframework.lang.Nullable;

import javax.validation.constraints.NotBlank;
import java.util.Locale;
import java.util.Optional;

/**
 * <p>ExtensionsMessageSourceResolveCodeProvider interface.</p>
 *
 * @author LiuYang
 * @since 2020/9/21
 * @version 1.0.0
 */
@FunctionalInterface
public interface ExtensionsMessageSourceResolveCodeProvider {
    /**
     * 解析code
     *
     * @param code code
     * @param locale 地区
     * @return 返回编码对应消息
     */
    Optional<String> resolveCode(@NotBlank String code, @Nullable Locale locale);
}
